// TypeScript file
class chathShowObjWnd extends eui.Component{

    private tx:eui.Label;
    private kuang:eui.Image;
    private tx_x:Array<number>;
    private X:number = 0;
    private Y:number = 0;

	public constructor() {
		super();
        this.addEventListener(eui.UIEvent.COMPLETE,this.onComplete,this);
		this.skinName = "src/Game/gameRoom/chat/chathShowObj.exml";				
	}
	private onComplete():void{
        //this.setStr("...");
        this.once(egret.Event.ADDED_TO_STAGE,this.onAddToStage,this);
	}
    private onAddToStage(){
        this.X = this.x;
        this.Y = this.y;
    }
    public setStr(str:string,Orientation:string="left"){
        this.tx.width = 1160;
        this.tx.height = 60;
        this.tx.text = str;
        this.tx.width = this.tx.textWidth+10;
        this.kuang.width = this.tx.width + 20;
        //alert(Orientation);
        switch(Orientation){
            case "left":
            this.kuang.source = "chath_left_png";
            this.kuang.x = 0;
            this.tx.x = 28;
            this.x = this.X;
            break;

            case "right":
            this.kuang.source = "chath_right_png";
            this.kuang.x = -this.kuang.width;
            this.tx.x = this.kuang.x + (this.kuang.width-this.tx.width-10);
            this.x = this.X + 100;
            break;

            case "up":
            this.kuang.source = "chath_up_png";
            this.kuang.x = -this.kuang.width;
            this.tx.x = this.kuang.x + (this.kuang.width-this.tx.width-10);
            this.x = this.X + 100;
            break;
        }
    }
}